//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Spreadsheet.Internals;

namespace OpenLS.Spreadsheet
{
    abstract class GroupBuilder
    {
        internal abstract RootGroupBuilder Root{ get;}
        internal readonly List<ChildGroupBuilder> Children = new List<ChildGroupBuilder>();
        public Group Group { get; protected set; }
        public abstract int Depth { get; }
        public void Apply()
        {
            ApplyThis();
            if (Group == null)
                return;
            foreach (ChildGroupBuilder builder in Children)
                builder.Apply();
        }

        protected abstract void ApplyThis();

    }
}
